package com.foo.ui_demo_widge;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class LoginActivity extends AppCompatActivity {
    public static final String EXTRE_MESSAGE ="com.example.ui_demo_widget1";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
        Button btn_login = findViewById(R.id.btn_login);
        btn_login.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
               sendMessage(v);
            }
        });
    }
    public void sendMessage(View v){
        Log.i("MyDebug","响应按钮点击事件");
        Intent intent = new Intent(this,InformationActivity.class);
        //找到文本内容
        EditText editText = findViewById(R.id.Textname);
        String message=editText.getText().toString();
        //把数据附加到intent上
        intent.putExtra(this.EXTRE_MESSAGE,message);
        //执行意图
        startActivity(intent);
    }
}